const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('downloadhistory', {
    id: {
      type: DataTypes.STRING(64),
      allowNull: false,
      primaryKey: true,
      comment: "唯一表示"
    },
    userId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "用户id"
    },
    oldFileName: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "原文件名"
    },
    downloadFileName: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "下载文件名"
    },
    ip: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "下载ip"
    },
    downloadFileId: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "下载文件的id"
    },
    createTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "下载时间"
    }
  }, {
    sequelize,
    tableName: 'downloadhistory',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
